Code profiling is a form of dynamic program analysis that measures, for example, the space (memory) or time complexity of a program, the usage of particular instructions, or frequency and duration of function calls. The most common use of profiling information is to aid program optimization. Profiling is achieved by instrumenting either the program source code or its binary executable form using a tool, e.g., a profiler. A number of different techniques may be used by profilers. Profiling adds instructions to the target program (e.g., source code or corresponding object code) to collect the execution-related information. However, instrumenting a program can require access to source code, can cause performance changes, and may lead to inaccurate results and/or heisenbugs. Some techniques use special hardware in the computers to collect information; in this case the impact on the program is minimal compared to instrumentation.
However, regardless of whether the code is profiled using the instrumentation technique or the special hardware, in some cases, e.g., for PHP code, the optimization achieved by them is not significant. These techniques consider optimizing the code based on the frequently executed path in the code, frequently executed functions, etc. However, none of these optimizations produce significant improvement in the execution of code.